package com.wk.wechattool.tool;
import android.view.accessibility.AccessibilityNodeInfo;
import java.util.List;


public class WeChatSportTool {

    public  void starAction(AccessibilityNodeInfo nodeInfo  ) {

        List<AccessibilityNodeInfo> peoples = nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/b39");
        if( BaseTool.isListEmpyty(peoples)){
           WkLog.d("运动人数=="+peoples.size()) ;
           return;
        }

        for(AccessibilityNodeInfo people: peoples){
            // 姓名区域
            List<AccessibilityNodeInfo> nameAreas = people.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/bpd");
            if(BaseTool.isListEmpyty(nameAreas)){
                WkLog.d("没有发现姓名区域");
                return;
            }

            String  name=  nameAreas.get(0).getText().toString();
            WkLog.d("name:="+name);

            // 如果不是自己，就全部点赞
            if(!name.equalsIgnoreCase("Aivin")){
                List<AccessibilityNodeInfo> cliclAreas = people.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/bob");
                if(BaseTool.isListEmpyty(cliclAreas)){
                    WkLog.d("没有发现点击区域="+name);
                    return;
                }

                AccessibilityNodeInfo clickArea=  cliclAreas.get(0);
                clickArea.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                WkLog.d("点击目标用户完毕="+name);
            }
        }
    }

}
